import type { CardListData, CardListParams, CardParams, RuleListData, RuleListParams } from '@/types/card'
import { request } from '@/utils/reuqest'

/**
 * 获取月卡列表
 * @param { page, pageSize} params
 * @returns
 */
export const getCardListAPI = (params: CardListParams) => {
  return request<CardListData>('/parking/card/list', 'GET', params)
}

/**
 * 增加月卡
 * @param  params
 * @returns
 */
export const addCardAPI = (params: Partial<CardParams>) => {
  return request('/parking/card', 'POST', params)
}


/**
 * 获取月卡详情
 * @data
 * @returns
 */
export const  getCardDetailAPI = (id: string) => {
  return request<CardParams>(`/parking/card/detail/${id}`, 'GET')
}

/**
 * 编辑月卡
 * @param {*} data
 * @returns
 */
export const updateCardAPI = (data: Partial<CardParams>) => {
  return request('/parking/card/edit', 'PUT', data)
}



/**
 * 删除月卡
 * @param ids 月卡id集合
 * @returns 
 */
export const deleCardAPI = (ids: number[]) => {
  return request(`/parking/card/${ids.join(',')}`, 'DELETE')
}


/**
 * 获取计费规则列表
 * @param params 
 * @returns 
 */
export const getRuleListAPI = (params: RuleListParams) => {
  return request<RuleListData>('/parking/rule/list', 'GET', params)
}